﻿DROP TABLE IF EXISTS `${table.tableName}`;
CREATE TABLE `${table.tableName}` (
  `${table.primaryProperty.name}` ${table.primaryProperty.type}(${table.primaryProperty.length}) NOT NULL <#if table.primaryProperty.increment?exists && table.primaryProperty.increment==true>AUTO_INCREMENT</#if>,
  <#list table.propertys as property>
  `${property.name}` <#if property.type=="boolean" >tinyint<#else>${property.type}</#if><#if property.type!="datetime" && property.type!="date">(<#if property.type=="boolean" >1<#else>${property.length}<#if property.precision?exists && (property.precision>0) >,${property.precision}</#if></#if>)</#if> DEFAULT <#if property.defaultValue?exists>'${property.defaultValue}'<#elseif property.dbDefaultValue?exists><#if property.type=="timestamp" || property.type=="datetime" || property.type=="date">${property.dbDefaultValue}<#else>'${property.dbDefaultValue}'</#if><#elseif property.notNull?exists && property.notNull==true><#if property.type=='varchar'>''<#else>0</#if></#if> <#if property.notNull?exists && property.notNull==true>NOT </#if>NULL COMMENT '<#if property.comment?exists>${property.comment}</#if>',
  </#list>
  PRIMARY KEY (`${table.primaryProperty.name}`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='${table.comment}';
